package com.top75;

/**
 * @Author: huangzhigao
 * @Date: 2023/5/10 20:35
 */
public class Code1768 {
    public static String mergeAlternately(String word1, String word2) {
        StringBuilder stringBuilder = new StringBuilder();
        int i = 0;
        while (i < word1.length() && i < word2.length()) {
            stringBuilder.append(word1.charAt(i));
            stringBuilder.append(word2.charAt(i));
            i++;
        }
        while (i < word1.length()) {
            stringBuilder.append(word1.charAt(i));
            i++;
        }
        while (i < word2.length()) {
            stringBuilder.append(word2.charAt(i));
            i++;

        }
        return stringBuilder.toString();
    }

}
